package com.guoli.print;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class TestPrintG {
	public static void main(String[] args) throws IOException {
		BufferedImage bi = new BufferedImage(112, 64, BufferedImage.TYPE_INT_RGB);
		Graphics2D graphics2d = (Graphics2D) bi.getGraphics();	
		graphics2d.fillOval(31, 7, 50, 50);
		File file = new File("C:\\Documents and Settings\\zhuxiaodong\\桌面\\yuan.jpg");
		ImageIO.write(bi, "jpg", file);
		
		String strx = "";
//		String result = "";
		for(int h = 0; h < 64; h++){
			for(int w = 0; w < 112; w++){
				strx += new Color(bi.getRGB(w, h)).getGreen()==0?"1":"0";
//				if(w%4==0&&w!=0){
//					result += Integer.toHexString(Integer.parseInt(strx, 2));
//					strx = "";
//				}
			}
			strx+="\n";
		}
		System.out.println("result = \n" + strx);
	}
}
